﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using FullSync;
using System.ComponentModel;
using Anywhere.Interface;
using System.ComponentModel.Composition;
using System.Windows.Input;

namespace MainApp
{
    public class MainViewModel : ViewModelBase
    {
        private ObservableCollection<IPlugin> _plugins = new ObservableCollection<IPlugin>();

        public ObservableCollection<IPlugin> Plugins
        {
            get { return _plugins; }
        }

        public MainViewModel()
        {
            var exportPlugins = CompositionHelper.Container.GetExportedValues<IPlugin>().ToList();

            foreach (var plugin in exportPlugins)
                Plugins.Add(plugin);
        }

        public void ReLoad()
        {
            var exportPlugins = CompositionHelper.Container.GetExportedValues<IPlugin>().ToList();

            foreach (var plugin in exportPlugins)
            {
                if (!Plugins.Contains(plugin))
                    Plugins.Add(plugin);

            }
        }
    }
}
